package cn.lx.ssh.dao;


import java.util.List;


import org.springframework.orm.hibernate3.support.HibernateDaoSupport;

import cn.lx.ssh.domain.Product;

public class ProductDao extends HibernateDaoSupport{

	public void save(Product product) {
		System.out.println("dao中的save方法执行啦");

		this.getHibernateTemplate().saveOrUpdate(product);
	}
	
	public List<Product> getList(){
		
		String sql = "From  Product";
		List<Product> list = this.getHibernateTemplate().find(sql);
		
		return list;
	}
	
	public Product findById(Integer pid){
		String sql = "From  Product where pid=?";
		List<Product> list = this.getHibernateTemplate().find(sql,pid);
		return list.get(0);

	}

}
